﻿using System;
using System.Windows;
using System.Globalization;

namespace WgpgGUI
{
    public static class L10N
    {
        private static ResourceDictionary _resourcedictionary;

        static L10N()
        {
            _resourcedictionary = new ResourceDictionary
            {
                Source = new Uri("/WgpgGUI;component/Resources/Localization.xaml", UriKind.RelativeOrAbsolute)
            };
        }

        public static String T(String id, params String[] args)
        {
            String t = (String)_resourcedictionary[id];

            if (String.IsNullOrEmpty(t) || args == null || args.Length == 0)
                return t;

            return String.Format(CultureInfo.CurrentCulture, t, args);
        }
    }
}
